package nuc.ss.novel.entity;

import java.util.Date;

/**
 * @author : zzr
 * @description :这里存储的是小说分类 也导入了Date包 因为有相关时间的变量
 * @date :2024_12_18
 */
public class Category {
    //分类id
    private Integer id;
    //分类名称
    private String categoryName;
    //分类备注
    private String remark;
    //某个分类下的小说数量
    private Integer totalNum;
    //添加时间
    private Date createTime;
    //更新时间
    private Date updateTime;

    //get and set method

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(Integer totalNum) {
        this.totalNum = totalNum;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    //重写 toString方法 只需要返回分类的名称即可

    @Override
    public String toString() {
        return categoryName;
    }

    //重写equals方法
    //同样用于集合类(Lis,Set) 查到特定的Category对象或者Set<Category>中确保不添加重复的Category对象
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        Category category = (Category)obj;
        if (this.id == category.getId() && this.categoryName.equals(category.getCategoryName())) {
            return true;
        }
        return false;
    }


}
